package org.duiduo.exception;

import org.duiduo.constant.ResponseConstants;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 错误控制层
 *
 * @author liangze
 * @date 2021/9/24 15:38
 */
@RestController
public class ErrorController {

    /**
     * 过滤器抛出自定义异常
     *
     * @param request
     */
    @RequestMapping("/error/exthrow")
    public void rethow(HttpServletRequest request) {
        throw new CustomException(ResponseConstants.Resp_1.REQ_02.getCode(), (String) request.getAttribute("filter.error"));
    }
}
